<?php

namespace addons\podunk\library;

Class CLog
{
    public static function write($msg=''){
        $file = RUNTIME_PATH.'clog'.DS.date('Y-m-d').'.log';
        $dir_name=dirname($file);

        if(!file_exists($dir_name))
        {
            //iconv防止中文名乱码
            $res = @mkdir(iconv("UTF-8", "GBK", $dir_name),0777,true);
        }
        file_put_contents($file, print_r( '['.date('Y-m-d H:i:s').']'.'  '.print_r($msg, true).PHP_EOL, true) , FILE_APPEND);
        return true;
    }
}